<style>
    body{
        color:#535353 !important
    }
    .req{
        color: red;
    }
    .layui-input-block input{
        width: 50%;
    }
    .layui-form-item .layui-input-inline {
        margin-right: 0px;
    }
    .layui-form-mid {
        padding: 8px 0 !important;
    }
    .div-text{
        background-color: #f3f3f3;
        border: 1px solid #e3e3e3;
        text-align: center;
        box-sizing:border-box;
        width: 100px;
    }
</style>
<div class="layuimini-container">
    <h2 style="margin-left: 30px;">预算控制</h2>
    <hr>
    <form id="app-form" class="layui-form layuimini-form">
        <input type="hidden" name="appid" value="{$rows.appid|default=''}">

        <div class="layui-form-item">
            <label class="layui-form-label" style="width:150px">每日支出上限($):</label>
            <div class="layui-input-inline">
                <input type="number" name="day_top" autocomplete="off" placeholder="应用每天可消耗的最高金额，不填则不做限制" class="layui-input"
                    value="{$rows.day_top|default=''}">
            </div>
            <div class="layui-form-mid layui-word-aux div-text">
                 元
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label" style="width:150px">每月支出上限($):</label>
            <div class="layui-input-inline">
                <input type="number" name="month_top" autocomplete="off" placeholder="应用每个自然月可消耗的最高金额，不填则不做限制" class="layui-input"
                    value="{$rows.month_top|default=''}">
            </div>
            <div class="layui-form-mid layui-word-aux div-text">
                元
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label required" style="width:150px">单笔交易审核下限($)：</label>
            <div class="layui-input-inline">
                <input type="number" name="need_check" autocomplete="off"  lay-verify="required" lay-reqtext="请输入单笔交易审核下限" placeholder="每笔交易的消费金额超过多少需要审核,0为每笔需要扣费的都审核" class="layui-input"
                    value="{$rows.need_check|default=''}" style="display: inline-block;">
            </div>
            <div class="layui-form-mid layui-word-aux div-text">
                元
            </div>
        </div>

        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button class="layui-btn  layui-btn-normal layui-btn-sm" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>
<script src="/static/common/js/jquery-1.10.1.min.js"></script>


<script>
    layui.use(['form', 'layer'], function() {
        form = layui.form,
        layer = layui.layer,

        addLinkUrl = "addData"

        //监听提交
        form.on('submit(formDemo)', function(data){
            $.ajax({
                url:addLinkUrl,
                data: $('#app-form').serialize(),
                type:'POST',
                success:function(result){
                    if (result.code == 1) {
                        layer.alert(result.msg, {icon: 1});
                    }else{
                        layer.alert(result.msg, {icon: 2});
                    }
                },
                error:function (res) {
                    layer.alert(result.msg, {icon: 2});
                }
            });

            return false;
        })

    })
</script>